<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录 </title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
</head>

<body style="background-color: #f1f1f1; padding-bottom: 0">


    {% include 'header.html' %}
    <div class="container" style="margin-top: 60px">

        <div class="row" style="margin-top: 100px">
            <div class="col-md-6 col-md-offset-3">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title"><span class="glyphicon glyphicon-console"></span> Login</h3>
                    </div>
                    <div class="panel-body">
                        <form action='/pydemo/login/' method="post">
                            {% csrf_token %}
                            <div class="form-group" style="margin-top: 30px">
                                <div class="input-group col-md-6 col-md-offset-3">
                                    <div class="input-group-addon"><span class="glyphicon glyphicon-user"></span></div>
                                    <input type="text" class="form-control" name="username" id="username" placeholder="账号">
                                </div>
                            </div>
                            <div class="form-group ">
                                <div class="input-group col-md-6 col-md-offset-3">
                                    <div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
                                    <input type="password" class="form-control" name="password" id="password" placeholder="密码">
                                </div>
                            </div>
                            <br>

                            <div class="form-group">
                                <div class="input-group col-md-6 col-md-offset-3 col-xs-12 ">
                                    <button type="submit" class="btn btn-primary btn-block">登录</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
          <button type="button" class="btn btn-primary btn-block" onclick="javascript:json()">json</button>
    </div>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
        function json() {
            axios.post('/pydemo/getjson/', {
                    ID: 12345
                })
                .then(function(response) {
                    console.log(response);
                })
                .catch(function(error) {
                    console.log(error);
                })
                .then(function() {
                    // always executed
                });
        }
    </script>
</body>

</html>